﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TourAgency.Admin.Modify
{
    public partial class EditTransport : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["editTransport"] != null)
                {
                    int editTransportID = int.Parse(Session["editTransport"].ToString());
                    ToursAgencyDAL.Transport editTransport = ToursAgencyDAL.ToursAgencyDataFuncs.GetTransportByID(editTransportID);
                    this.textBoxName.Text = editTransport.Name;
                }
            }
        }

        protected void buttonSaveTransport_Click(object sender, EventArgs e)
        {
            ToursAgencyDAL.Transport transport = new ToursAgencyDAL.Transport();
            int transportID = int.Parse(Session["editTransport"].ToString());
            transport.ID = transportID;
            transport.Name = this.textBoxName.Text;
            ToursAgencyDAL.ToursAgencyDataFuncs.EditTransport(transport);
            Response.Redirect("~/Admin/Transport.aspx");
        }
    }
}